package clz;

import java.util.Calendar;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Hishan
 */
public class GetInfoOfID {

    private static int day_of_year = 1;
    private static int month_of_year = 0;
    private static int year=0;
    private static boolean LeapYear=false;
//    public static void main(String[] args) {
//        Calendar c = Calendar.getInstance();
//        int day_of_year = c.get(Calendar.DAY_OF_YEAR);
//        int month_of_year = c.get(Calendar.MONTH);
//        int year = c.get(Calendar.YEAR);
//        boolean LeapYear = false;
//        if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
//            LeapYear = true;
//        } else {
//            LeapYear = false;
//        }
//        if (!LeapYear && month_of_year > Calendar.FEBRUARY) {
//            day_of_year++;
//        }
//        System.out.println(day_of_year);
//    }
    public static void getInfo(int year, int nextThreeDigits) {
        String year_string = String.valueOf(year);
        year_string = "19" + year_string;
        year = Integer.parseInt(year_string);
        Calendar c = Calendar.getInstance();
        c.set(Calendar.YEAR, year);
        if (nextThreeDigits > 500) {
            setDay_of_year(nextThreeDigits - 500);
        }else{
            setDay_of_year(nextThreeDigits);
        }
        if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
            setIsLeapYear(true);
        } else {
            setIsLeapYear(false);
        }
        setMonth_of_year(c.get(Calendar.MONTH));
        if (!isLeapYear() && getMonth_of_year()>Calendar.FEBRUARY) {
            setDay_of_year(getDay_of_year()-1);
            
        }
        c.set(Calendar.DAY_OF_YEAR, getDay_of_year());
        System.out.println(c.getTime());
    }

    private static int getDay_of_year() {
        return day_of_year;
    }

    private static void setDay_of_year(int day_of_year) {
        GetInfoOfID.day_of_year = day_of_year;
    }

    private static int getMonth_of_year() {
        return month_of_year;
    }

    private static void setMonth_of_year(int month_of_year) {
        GetInfoOfID.month_of_year = month_of_year;
    }

    private static int getYear() {
        return year;
    }

    private static void setYear(int year) {
        GetInfoOfID.year = year;
    }

    private static boolean isLeapYear() {
        return LeapYear;
    }

    private static void setIsLeapYear(boolean aIsLeapYear) {
        LeapYear = aIsLeapYear;
    }
}
